package realm.inorder.itmill.ui.menu;

import com.itmill.toolkit.ui.Button;
import com.itmill.toolkit.ui.Component;
import com.itmill.toolkit.ui.Button.ClickEvent;
import com.itmill.toolkit.ui.Button.ClickListener;

public abstract class SimpleMenuOption extends MenuOption {

	private String caption;
	
	public SimpleMenuOption(String caption) {
		super();
		this.caption = caption;
	}

	@Override
	public Component getComponent() {
		Button button = new Button(caption);
		button.setStyleName("link");
		button.addListener(new ClickListener() {
			public void buttonClick(ClickEvent event) {
				performAction(event);
			}
		});
		return button;
	}

	public abstract void performAction(ClickEvent clickEvent);
	
	public String getCaption() {
		return caption;
	}

	public void setCaption(String caption) {
		this.caption = caption;
	}

}
